<template>
	<view class="page">
		<!-- 导航栏 -->
		<free-nav-bar title="群公告" showBack bgColor="bg-white">
			<free-main-button slot="right" name="推送" @click="submit"></free-main-button>
		</free-nav-bar>
		
		<textarea v-model="remark" placeholder="请填写群公告内容..." 
		class="bg-white p-2 font-md w-100" style="box-sizing: border-box;"></textarea>
	</view>
</template>

<script>
	import freeNavBar from "@/components/free-ui/free-nav-bar.vue"
	import freeMainButton from "@/components/free-ui/free-main-button.vue"
	import $H from "@/common/free-lib/request.js"
	import auth from "@/common/mixin/auth.js"
	export default {
		data() {
			return {
				id:0,
				remark:''
			}
		},
		mixins:[auth],
		onLoad(e){
			if(!e.params){
				return this.backToast()
			}
			let params = JSON.parse(decodeURIComponent(e.params))
			this.id = params.id
			this.remark = params.remark
		},
		methods: {
			submit(){
				$H.post('/group/remark',{
					id: this.id,
					remark: this.remark
				}).then(res=>{
					uni.showToast({
						title: '推送成功'
					});
					uni.navigateBack({
						delta: 1
					});
				})
			}
		},
		components:{
			freeNavBar,
			freeMainButton
		}
	}
</script>

<style>

</style>
